<?

//Initiate Authenticate
SecurityRedirect ();

//initiate Vars 
define("PRIMARY_KEY","kdother");
$KEY[]         = array("PRIMARY_KEY"=>PRIMARY_KEY);
$FileName      = "ais_transaction_otherdebtur.php";
$FormName			 = GetParam("FormName","");
if (GetParam("Template","")=="DN") $FileTemplate  = "ais_transaction_otherlist_dnlist.html";
elseif ((GetParam("FormName","")=="MemorialTransForm") && !GetParam("SendToBack","")) {$FileTemplate = "ais_transaction_otherlist_memotrans.html";}
elseif ((GetParam("FormName","")=="CashBankForm") && !GetParam("SendToBack","")) {$FileTemplate = "ais_transaction_otherlist_cashbanktrans.html";}
elseif ((GetParam("FormName","")=="CashBankPaymentForm") && !GetParam("SendToBack","")) {$FileTemplate = "ais_transaction_otherlist_cashbanktrans_pay.html";}
else $FileTemplate  = "ais_transaction_otherlist_list.html";
$PageSize      = 10 ;
$HTMLGridList  = "OtherGrid";
//************ FORM ACTION **************
	if (GetParam("Action","")=="Delete") {
		DeleteRecord ("txtCheck",$PageSize);
	}

//Initiate Database Table For Search;
$FNama = GetParam("otherSearch","");
$FCode = GetParam("otherCodeSearch","");
$FieldDebnam = GetParam("FieldDebnam","");
$FieldDebtur = GetParam("FieldDebtur","");
$FDate = GetParam("transDate","");
$curr   = GetParam("curr","");
//******* DATABASE FORM QUERY ***********
$SQL = "SELECT * FROM `tbldebtur` ";
$SQLCount = "SELECT count(*) FROM `tbldebtur` ";

if ($FNama) 
	if (strlen($WHERE)) $WHERE .= " AND "." cuname like '".GetParam("otherSearch","")."%'";
	else $WHERE .= " cuname like '".GetParam("otherSearch","")."%'";	
if ($FCode) 
	if (strlen($WHERE)) $WHERE .= " AND "." cucode like '".GetParam("otherCodeSearch","")."%'";
	else $WHERE .= " cucode like '".GetParam("otherCodeSearch","")."%'";

	if (strlen($WHERE))	$WHERE = " WHERE ".$WHERE;
	else $WHERE = " WHERE 1";

$SQL = $SQL.$WHERE." ORDER BY cucode";
//print $SQL;
//******* SHOW FORM CONTENT *********
$SQLCount = $SQLCount.$WHERE;
$PageNum = 1;
$RecCnt = $DBConnection->dbc->get_var($SQLCount) ; 

if (GetParam("PageNum","")) $PageNum  = GetParam("PageNum","");

$TBS = new clsTinyButStrong ;
$TBS->LoadTemplate($MOD_TEMPLATE_DIR."/".$FileTemplate);
$TBS->MergeBlock("bln",$KEY);
$TBS->MergeBlock("blg",$DBMysql,$SQL,$PageSize,$PageNum,$RecCnt);
$TBS->MergeNavigationBar('nv',array('size'=>10,'pos'=>'centred'),$PageNum,$RecCnt,$PageSize) ; 
$TBS->Show();


?>